package com.wulaobo.functions;

import com.wulaobo.pojo.WaterSensor;
import org.apache.flink.api.common.functions.MapFunction;

/**
 * @Author wuwenbo
 * @Date 2024/5/24 10:53
 * @ClassName: WaterSensorMapFunction
 * @Description: TODO
 */
public class WaterSensorMapFunction implements MapFunction<String, WaterSensor> {

    @Override
    public WaterSensor map(String value) throws Exception {
        String[] splits = value.split(",");
        WaterSensor waterSensor = new WaterSensor(splits[0], Integer.parseInt(splits[1]), Integer.parseInt(splits[2]));
        return waterSensor;
    }

}
